/**
 * 
 */
package uit.comstore.model.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author XIII
 *
 */
@Entity
@Table(name="ImportBills")
@SuppressWarnings("serial")
public class ImportBill implements Serializable {

	private Long id;
	private Date dateImported;
	private BigDecimal total;
	
	private Supplier supplier;
	private Set<ImportBillDetail> importBillDetail = new HashSet<ImportBillDetail>();

	@Id
	@GeneratedValue
	@Column(name="ImportBillsId")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}

	@Column(name="DateImported")
	public Date getDateImported() {
		return dateImported;
	}
	public void setDateImported(Date dateImported) {
		this.dateImported = dateImported;
	}

	@Column(name="ImportBillsTotal")
	public BigDecimal getTotal() {
		return total;
	}
	public void setTotal(BigDecimal total) {
		this.total = total;
	}

	@ManyToOne(cascade=CascadeType.MERGE)
	@JoinColumn(name="SuppliersId", referencedColumnName="SuppliersId")
	public Supplier getSupplier() {
		return supplier;
	}
	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}
	
	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	@JoinColumn(name="ImportBillsId", referencedColumnName="ImportBillsId")
	public Set<ImportBillDetail> getImportBillDetail() {
		return importBillDetail;
	}
	public void setImportBillDetail(Set<ImportBillDetail> importBillDetail) {
		this.importBillDetail = importBillDetail;
	}
}
